[testbot] Add tests for date-range-utils.test.ts#831
[testbot] Add tests for date-range-utils.test.ts#831svc-osmo-ci wants to merge 2 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #831 +/- ##
==========================================
+ Coverage 42.61% 42.91% +0.29%
==========================================
Files 203 203
Lines 27025 27025
Branches 7652 7652
==========================================
+ Hits 11517 11597 +80
+ Misses 15397 15317 -80
Partials 111 111
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughA new Vitest test suite was added at Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/ui/src/lib/date-range-utils.test.ts (1)
129-133: Tighten these tests by assertingendtoo.These cases only assert
start, which can miss regressions in end-boundary handling.Proposed test-strengthening diff
it("handles range with whitespace around dates", () => { const result = parseDateRangeValue(" 2026-01-01 .. 2026-01-31 "); expect(result).not.toBeNull(); expect(result!.start.toISOString()).toBe("2026-01-01T00:00:00.000Z"); + expect(result!.end.toISOString()).toBe("2026-02-01T00:00:00.000Z"); }); @@ it("parses preset labels case-insensitively", () => { const result = parseDateRangeValue("TODAY"); expect(result).not.toBeNull(); expect(result!.start.toISOString()).toBe("2026-03-15T00:00:00.000Z"); + expect(result!.end.toISOString()).toBe("2026-03-16T00:00:00.000Z"); }); @@ it("parses mixed case preset label", () => { const result = parseDateRangeValue("Last 7 Days"); expect(result).not.toBeNull(); expect(result!.start.toISOString()).toBe("2026-03-08T00:00:00.000Z"); + expect(result!.end.toISOString()).toBe("2026-03-16T00:00:00.000Z"); });Also applies to: 182-192
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/src/lib/date-range-utils.test.ts` around lines 129 - 133, The test for parseDateRangeValue only asserts the start date and should also assert the end date to catch regressions; update the spec that calls parseDateRangeValue(" 2026-01-01 .. 2026-01-31 ") to assert result!.end.toISOString() equals "2026-01-31T00:00:00.000Z" (and similarly tighten the other test block around lines 182-192 that uses parseDateRangeValue by adding an assertion for result!.end.toISOString() with the expected ISO end value).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/ui/src/lib/date-range-utils.test.ts`:
- Around line 129-133: The test for parseDateRangeValue only asserts the start
date and should also assert the end date to catch regressions; update the spec
that calls parseDateRangeValue(" 2026-01-01 .. 2026-01-31 ") to assert
result!.end.toISOString() equals "2026-01-31T00:00:00.000Z" (and similarly
tighten the other test block around lines 182-192 that uses parseDateRangeValue
by adding an assertion for result!.end.toISOString() with the expected ISO end
value).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9feda9ea-8e36-4c34-9f83-34e540c492c7
📒 Files selected for processing (1)
src/ui/src/lib/date-range-utils.test.ts
Summary
AI-generated tests targeting file(s) with low coverage.
Issue - None
Files tested
src/ui/src/lib/date-range-utils.test.tsChecklist
Generated by testbot pipeline
Summary by CodeRabbit